#include <iostream>
using namespace std;
#include <unistd.h>
extern char** environ;

int main(int argc, char* argv[], char* env[])
{
    cout << argv[0] << " begin running" << endl;
    cout << "这是命令行参数：\n";
    for (int i = 0; i < argc; ++i)
    {
        cout << i << ": " << argv[i] << endl;
    }
    cout << "这是环境变量：\n";
    for (int i = 0; env[i]; ++i) // 太长了，只打印前5个
    {

        cout << i << ": " << env[i] << endl;
    }
    cout << environ[0] << endl;
    //cout << "PRIVATE_ENV=" << getenv("PRIVATE_ENV") << endl;
    cout << argv[0] << " stop running" << endl;
    return 0;
}


